function ajax({ method = 'get', data = null, url = "http://api.ruohan.store/useradmin" }) {
    return new Promise((resolve, reject) => {
        $.ajax({
            type: method,
            url: url,
            data: data,
            dataType: "json",
            success: function(response) {
                if (response.code == 0) {
                    resolve(response)
                } else {
                    reject(response.errInfo)
                }
            }
        });
    })
}
//删除api

let delUser = (data) => ajax({
    data,
    method: 'delete',
});
//渲染api

let renderUser = (data) => ajax({
    data,
    method: 'get',
})
let suLists = (data) => ajax({
        data,
        method: `${data.id?'put':'post'}`
    })
    /* 用户注册登陆相关 */

// reg interface'  

let regUser = (data) => ajax({
    url: '/api/register',
    data,
    method: 'post'
})

let reqLogin = (data) => ajax({
    url: '/api/login',
    data,
    method: 'post'
})

// 获得密钥         
let getToken = () => ajax({
    url: '/api/getToken'
})


/* 用户列表相关数据请求 */

let getLists = (data) => ajax({
    url: `${BACK_END_URL}/useradmin`,
})